package bean.dao.impl;

import bean.dao.IUserDao;
import bean.domain.User;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;

/**
 * @author peter
 * @date 2021/12/4 上午2:19
 */
public class UserDaoImpl implements IUserDao {

    public User user;

    private int i = 1;

    @Override
    public List<User> selectAll() {
        System.out.println("UserDaoImpl select all");
        user.setId(1);
        return null;
    }

    public Integer getIbyAdd(Integer addNum) {
        return i += addNum;
    }

    @PostConstruct
    public void init() {
        System.out.println("UserDaoImpl init method");
    }

    @PreDestroy
    public void destory() {
        System.out.println("UserDaoImpl destory method");
    }

    public void setUser(User user) {
        this.user = user;
    }

    public User getUser() {
        return user;
    }
}
